package com.landtool.database.service.impl;

import com.landtool.database.entity.BdDataFusion;
import com.landtool.database.mapper.BdDataFusionMapper;
import com.landtool.database.service.BdDataFusionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 北斗船舶ID与雷达tagid及时间的对照表(BdDataFusion)表服务实现类
 *
 * @author lizhao
 * @since 2019-05-14 15:44:24
 */
@Service("bdDataFusionService")
public class BdDataFusionServiceImpl implements BdDataFusionService {
    @Resource
    private BdDataFusionMapper bdDataFusionMapper;



    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BdDataFusion queryById(Integer id) {
        return this.bdDataFusionMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<BdDataFusion> queryAllByLimit(int offset, int limit) {
        return this.bdDataFusionMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param bdDataFusion 实例对象
     * @return 实例对象
     */
    @Override
    public BdDataFusion insert(BdDataFusion bdDataFusion) {
        this.bdDataFusionMapper.insert(bdDataFusion);
        return bdDataFusion;
    }
    
    /**
     * 新增部分数据
     *
     * @param bdDataFusion 实例对象
     * @return 实例对象
     */
    @Override
    public BdDataFusion insertSelective(BdDataFusion bdDataFusion) {
        this.bdDataFusionMapper.insertSelective(bdDataFusion);
        return bdDataFusion;
    }

    /**
     * 修改数据
     *
     * @param bdDataFusion 实例对象
     * @return 实例对象
     */
    @Override
    public BdDataFusion update(BdDataFusion bdDataFusion) {
        this.bdDataFusionMapper.update(bdDataFusion);
        return this.queryById(bdDataFusion.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.bdDataFusionMapper.deleteById(id) > 0;
    }

    @Override
    public List <BdDataFusion> queryAll(BdDataFusion bdDataFusion) {
        return this.bdDataFusionMapper.queryAll(bdDataFusion);
    }

    @Override
    public List <BdDataFusion> GetRecentList() {
        return this.bdDataFusionMapper.GetRecentList();
    }
}